﻿﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace BingZi.HY.Core
{
    /// <summary></summary>
    [Serializable]
    [DataObject]
    [Description("用户详情")]
    [BindIndex("PK_app_UserInfo", true, "ValueID")]
    [BindTable("app_UserInfo", Description = "用户详情", ConnName = "System")]
    public partial class app_UserInfo<TEntity> : Iapp_UserInfo
    {
        #region 属性
        private Int32 _ValueID = 0;
        /// <summary>用户信息编号</summary>
        [DisplayName("用户信息编号")]
        [Description("用户信息编号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn(1, "ValueID", "用户信息编号", null, "int", 10, 0, false)]
        public Int32 ValueID
        {
            get { return _ValueID; }
            set { if (OnPropertyChanging("ValueID", value)) { _ValueID = value; OnPropertyChanged("ValueID"); } }
        }

        private Int32 _UserID = 0;
        /// <summary>用户</summary>
        [DisplayName("用户")]
        [Description("用户")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(2, "UserID", "用户", null, "int", 10, 0, false)]
        public Int32 UserID
        {
            get { return _UserID; }
            set { if (OnPropertyChanging("UserID", value)) { _UserID = value; OnPropertyChanged("UserID"); } }
        }

        private String _UserName = String.Empty;
        /// <summary>用户名</summary>
        [DisplayName("用户名")]
        [Description("用户名")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn(3, "UserName", "用户名", "", "nvarchar(50)", 0, 0, true)]
        public String UserName
        {
            get { return _UserName; }
            set { if (OnPropertyChanging("UserName", value)) { _UserName = value; OnPropertyChanged("UserName"); } }
        }

        private String _CName = String.Empty;
        /// <summary>中文姓名</summary>
        [DisplayName("中文姓名")]
        [Description("中文姓名")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(4, "CName", "中文姓名", "", "nvarchar(20)", 0, 0, true)]
        public String CName
        {
            get { return _CName; }
            set { if (OnPropertyChanging("CName", value)) { _CName = value; OnPropertyChanged("CName"); } }
        }

        private Int32 _Sex = 2;
        /// <summary>性别2:保密,1:男,0:女</summary>
        [DisplayName("性别2:保密,1:男,0:女")]
        [Description("性别2:保密,1:男,0:女")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(5, "Sex", "性别2:保密,1:男,0:女", "2", "tinyint", 3, 0, false)]
        public Int32 Sex
        {
            get { return _Sex; }
            set { if (OnPropertyChanging("Sex", value)) { _Sex = value; OnPropertyChanged("Sex"); } }
        }

        private DateTime _BirthDay = DateTime.Now.AddYears(-20);
        /// <summary>出生日期</summary>
        [DisplayName("出生日期")]
        [Description("出生日期")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(6, "BirthDay", "出生日期", "", "datetime", 3, 0, false)]
        public DateTime BirthDay
        {
            get { return _BirthDay; }
            set { if (OnPropertyChanging("BirthDay", value)) { _BirthDay = value; OnPropertyChanged("BirthDay"); } }
        }

        private String _IDCard = String.Empty;
        /// <summary>身份证号码</summary>
        [DisplayName("身份证号码")]
        [Description("身份证号码")]
        [DataObjectField(false, false, true, 30)]
        [BindColumn(7, "IDCard", "身份证号码", "", "varchar(30)", 0, 0, false)]
        public String IDCard
        {
            get { return _IDCard; }
            set { if (OnPropertyChanging("IDCard", value)) { _IDCard = value; OnPropertyChanged("IDCard"); } }
        }

        private String _MSN = String.Empty;
        /// <summary>MSN</summary>
        [DisplayName("MSN")]
        [Description("MSN")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(8, "MSN", "MSN", "", "varchar(50)", 0, 0, false)]
        public String MSN
        {
            get { return _MSN; }
            set { if (OnPropertyChanging("MSN", value)) { _MSN = value; OnPropertyChanged("MSN"); } }
        }

        private String _QQ = String.Empty;
        /// <summary>QQ</summary>
        [DisplayName("QQ")]
        [Description("QQ")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(9, "QQ", "QQ", "", "varchar(20)", 0, 0, false)]
        public String QQ
        {
            get { return _QQ; }
            set { if (OnPropertyChanging("QQ", value)) { _QQ = value; OnPropertyChanged("QQ"); } }
        }

        private String _MobilePhone = String.Empty;
        /// <summary>移动电话</summary>
        [DisplayName("移动电话")]
        [Description("移动电话")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(10, "MobilePhone", "移动电话", "", "varchar(20)", 0, 0, false)]
        public String MobilePhone
        {
            get { return _MobilePhone; }
            set { if (OnPropertyChanging("MobilePhone", value)) { _MobilePhone = value; OnPropertyChanged("MobilePhone"); } }
        }

        private Int32 _MobilePhoneState = (Int32)BingZi.HY.Core.EnumMobileState.No;
        /// <summary>手机认证状态(0:未认证,1:认证)</summary>
        [DisplayName("手机认证状态(0:未认证,1:认证)")]
        [Description("手机认证状态(0:未认证,1:认证)")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(11, "MobilePhoneState", "手机认证状态(0:未认证,1:认证)", "0", "tinyint", 3, 0, false)]
        public Int32 MobilePhoneState
        {
            get { return _MobilePhoneState; }
            set { if (OnPropertyChanging("MobilePhoneState", value)) { _MobilePhoneState = value; OnPropertyChanged("MobilePhoneState"); } }
        }

        private String _Phone = String.Empty;
        /// <summary>电话</summary>
        [DisplayName("电话")]
        [Description("电话")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(12, "Phone", "电话", "", "varchar(20)", 0, 0, false)]
        public String Phone
        {
            get { return _Phone; }
            set { if (OnPropertyChanging("Phone", value)) { _Phone = value; OnPropertyChanged("Phone"); } }
        }

        private String _Fax = String.Empty;
        /// <summary>传真</summary>
        [DisplayName("传真")]
        [Description("传真")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(13, "Fax", "传真", "", "varchar(20)", 0, 0, false)]
        public String Fax
        {
            get { return _Fax; }
            set { if (OnPropertyChanging("Fax", value)) { _Fax = value; OnPropertyChanged("Fax"); } }
        }

        private String _Position = String.Empty;
        /// <summary>职位</summary>
        [DisplayName("职位")]
        [Description("职位")]
        [DataObjectField(false, false, true, 20)]
        [BindColumn(14, "Position", "职位", "", "varchar(20)", 0, 0, false)]
        public String Position
        {
            get { return _Position; }
            set { if (OnPropertyChanging("Position", value)) { _Position = value; OnPropertyChanged("Position"); } }
        }

        private Int32 _LastUserID = 0;
        /// <summary>最后操作用户</summary>
        [DisplayName("最后操作用户")]
        [Description("最后操作用户")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(15, "LastUserID", "最后操作用户", "0", "int", 10, 0, false)]
        public Int32 LastUserID
        {
            get { return _LastUserID; }
            set { if (OnPropertyChanging("LastUserID", value)) { _LastUserID = value; OnPropertyChanged("LastUserID"); } }
        }

        private DateTime _LastTime = DateTime.Now;
        /// <summary>最后操作时间</summary>
        [DisplayName("最后操作时间")]
        [Description("最后操作时间")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(16, "LastTime", "最后操作时间", "", "datetime", 3, 0, false)]
        public DateTime LastTime
        {
            get { return _LastTime; }
            set { if (OnPropertyChanging("LastTime", value)) { _LastTime = value; OnPropertyChanged("LastTime"); } }
        }

        private String _LastIP = String.Empty;
        /// <summary>最后操作IP</summary>
        [DisplayName("最后操作IP")]
        [Description("最后操作IP")]
        [DataObjectField(false, false, false, 15)]
        [BindColumn(17, "LastIP", "最后操作IP", "", "varchar(15)", 0, 0, false)]
        public String LastIP
        {
            get { return _LastIP; }
            set { if (OnPropertyChanging("LastIP", value)) { _LastIP = value; OnPropertyChanged("LastIP"); } }
        }

        private Int32 _State =(Int32)BingZi.HY.Core.EnumState.NoSunbit;
        /// <summary>状态(0:待审核,1:已审核,2:已锁定,3:未提交)</summary>
        [DisplayName("状态(0:待审核,1:已审核,2:已锁定,3:未提交)")]
        [Description("状态(0:待审核,1:已审核,2:已锁定,3:未提交)")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(18, "State", "状态(0:待审核,1:已审核,2:已锁定,3:未提交)", "0", "tinyint", 3, 0, false)]
        public Int32 State
        {
            get { return _State; }
            set { if (OnPropertyChanging("State", value)) { _State = value; OnPropertyChanged("State"); } }
        }
		#endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ValueID" : return _ValueID;
                    case "UserID" : return _UserID;
                    case "UserName" : return _UserName;
                    case "CName" : return _CName;
                    case "Sex" : return _Sex;
                    case "BirthDay" : return _BirthDay;
                    case "IDCard" : return _IDCard;
                    case "MSN" : return _MSN;
                    case "QQ" : return _QQ;
                    case "MobilePhone" : return _MobilePhone;
                    case "MobilePhoneState" : return _MobilePhoneState;
                    case "Phone" : return _Phone;
                    case "Fax" : return _Fax;
                    case "Position" : return _Position;
                    case "LastUserID" : return _LastUserID;
                    case "LastTime" : return _LastTime;
                    case "LastIP" : return _LastIP;
                    case "State" : return _State;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ValueID" : _ValueID = Convert.ToInt32(value); break;
                    case "UserID" : _UserID = Convert.ToInt32(value); break;
                    case "UserName" : _UserName = Convert.ToString(value); break;
                    case "CName" : _CName = Convert.ToString(value); break;
                    case "Sex": _Sex = Convert.ToInt32(value); break;
                    case "BirthDay" : _BirthDay = Convert.ToDateTime(value); break;
                    case "IDCard" : _IDCard = Convert.ToString(value); break;
                    case "MSN" : _MSN = Convert.ToString(value); break;
                    case "QQ" : _QQ = Convert.ToString(value); break;
                    case "MobilePhone" : _MobilePhone = Convert.ToString(value); break;
                    case "MobilePhoneState": _MobilePhoneState = Convert.ToInt32(value); break;
                    case "Phone" : _Phone = Convert.ToString(value); break;
                    case "Fax" : _Fax = Convert.ToString(value); break;
                    case "Position" : _Position = Convert.ToString(value); break;
                    case "LastUserID" : _LastUserID = Convert.ToInt32(value); break;
                    case "LastTime" : _LastTime = Convert.ToDateTime(value); break;
                    case "LastIP" : _LastIP = Convert.ToString(value); break;
                    case "State": _State = Convert.ToInt32(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>用户信息编号</summary>
            public static readonly FieldItem ValueID = Meta.Table.FindByName("ValueID");

            ///<summary>用户</summary>
            public static readonly FieldItem UserID = Meta.Table.FindByName("UserID");

            ///<summary>用户名</summary>
            public static readonly FieldItem UserName = Meta.Table.FindByName("UserName");

            ///<summary>中文姓名</summary>
            public static readonly FieldItem CName = Meta.Table.FindByName("CName");

            ///<summary>性别2:保密,1:男,0:女</summary>
            public static readonly FieldItem Sex = Meta.Table.FindByName("Sex");

            ///<summary>出生日期</summary>
            public static readonly FieldItem BirthDay = Meta.Table.FindByName("BirthDay");

            ///<summary>身份证号码</summary>
            public static readonly FieldItem IDCard = Meta.Table.FindByName("IDCard");

            ///<summary>MSN</summary>
            public static readonly FieldItem MSN = Meta.Table.FindByName("MSN");

            ///<summary>QQ</summary>
            public static readonly FieldItem QQ = Meta.Table.FindByName("QQ");

            ///<summary>移动电话</summary>
            public static readonly FieldItem MobilePhone = Meta.Table.FindByName("MobilePhone");

            ///<summary>手机认证状态(0:未认证,1:认证)</summary>
            public static readonly FieldItem MobilePhoneState = Meta.Table.FindByName("MobilePhoneState");

            ///<summary>电话</summary>
            public static readonly FieldItem Phone = Meta.Table.FindByName("Phone");

            ///<summary>传真</summary>
            public static readonly FieldItem Fax = Meta.Table.FindByName("Fax");

            ///<summary>职位</summary>
            public static readonly FieldItem Position = Meta.Table.FindByName("Position");

            ///<summary>最后操作用户</summary>
            public static readonly FieldItem LastUserID = Meta.Table.FindByName("LastUserID");

            ///<summary>最后操作时间</summary>
            public static readonly FieldItem LastTime = Meta.Table.FindByName("LastTime");

            ///<summary>最后操作IP</summary>
            public static readonly FieldItem LastIP = Meta.Table.FindByName("LastIP");

            ///<summary>状态(0:待审核,1:已审核,2:已锁定,3:未提交)</summary>
            public static readonly FieldItem State = Meta.Table.FindByName("State");
        }
        #endregion
    }

    /// <summary>接口</summary>
    public partial interface Iapp_UserInfo
    {
        #region 属性
        /// <summary>用户信息编号</summary>
        Int32 ValueID { get; set; }

        /// <summary>用户</summary>
        Int32 UserID { get; set; }

        /// <summary>用户名</summary>
        String UserName { get; set; }

        /// <summary>中文姓名</summary>
        String CName { get; set; }

        /// <summary>性别2:保密,1:男,0:女</summary>
        Int32 Sex { get; set; }

        /// <summary>出生日期</summary>
        DateTime BirthDay { get; set; }

        /// <summary>身份证号码</summary>
        String IDCard { get; set; }

        /// <summary>MSN</summary>
        String MSN { get; set; }

        /// <summary>QQ</summary>
        String QQ { get; set; }

        /// <summary>移动电话</summary>
        String MobilePhone { get; set; }

        /// <summary>手机认证状态(0:未认证,1:认证)</summary>
        Int32 MobilePhoneState { get; set; }

        /// <summary>电话</summary>
        String Phone { get; set; }

        /// <summary>传真</summary>
        String Fax { get; set; }

        /// <summary>职位</summary>
        String Position { get; set; }

        /// <summary>最后操作用户</summary>
        Int32 LastUserID { get; set; }

        /// <summary>最后操作时间</summary>
        DateTime LastTime { get; set; }

        /// <summary>最后操作IP</summary>
        String LastIP { get; set; }

        /// <summary>状态(0:待审核,1:已审核,2:已锁定,3:未提交)</summary>
        Int32 State { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}